// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import Axios from 'axios'
//加载vant核心组件库
import Vant from 'vant'
//加载vant全局样式
import 'vant/lib/index.css'
import { Lazyload } from 'vant';
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'


// import MintUI from 'mint-ui'
// import 'mint-ui/lib/style.css'
// import NutUI from '@nutui/nutui';
// import '@nutui/nutui/dist/nutui.css';

// Vue.use(MintUI)
// Vue.use(NutUI)

/*import MintUI from 'mint-ui'
import 'mint-ui/lib/style.css'
import NutUI from '@nutui/nutui';
import '@nutui/nutui/dist/nutui.css';*/
import { List } from 'vant';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import cookie from 'vue-cookies'//引入cookie
import NutUI from '@nutui/nutui';
import '@nutui/nutui/dist/nutui.css';
import { PasswordInput, NumberKeyboard } from 'vant';

import { NavBar } from 'vant';
//标签页
import { PullRefresh } from 'vant';
Vue.use(PullRefresh);
Vue.use(ElementUI);
NutUI.install(Vue);
import { Tabbar, TabbarItem } from 'vant';
import { Toast } from 'vant';
// use
Vue.use(mavonEditor)
Vue.use(NavBar);
/*Vue.use(MintUI)
Vue.use(NutUI)*/
Vue.use(List);

Vue.use(PasswordInput);
Vue.use(NumberKeyboard);
Vue.prototype.$axios = Axios
Vue.prototype.$notify = Notification

//注册使用vant组件库
Vue.use(Vant);
Vue.use(Lazyload);
Vue.config.productionTip = false

Axios.defaults.withCredentials=true
Vue.use(cookie)
Vue.prototype.$axios = Axios
//路由守卫 在每次路由抓换时，都需要执行的方法
// router.beforeEach((to, from, next) => {
 //if (to.name !== 'login' && !isAuthenticated) next({ name: 'Login' })
  // 如果用户未能验证身份，则 `next` 会被调用两次
  //从cookie中获取到userId

  // var isAuthenticated = false;
  // var userId =cookie.get("userId");
  //将token串设置到头部中

    // console.log("路由守卫"+userId);
  //   axios.defaults.headers={
  //     "userId":'23333'
  // }

//  axios.get("http://localhost:7000/user/userLogin").then(res=>{
//         if (res.data.code==1){
//           isAuthenticated=true;
//         }
//       if (to.name !== 'login' && !isAuthenticated) next({ name: 'login' })
//       else
//         next();
//     })
// })

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
